package test1225;

public class  Test11 {
    public static void main(String[] args) {
        // 返回2个数组的交集
        int[] arr = {1,2,3,4,5};
        int[] brr = {3,4,5,6,7};
        int[] crr = m11(arr, brr);
        for (int c:crr) {
            System.out.println(c);
        }
    }
    public static int[] m11(int[] arr,int[] brr){

        int[] crr = new int[40];
        int jiao = 0;
        for(int i = 0; i<arr.length ; i++){
            for(int j = 0; j<brr.length; j++){
                if(arr[i]==brr[j]){
                    crr[jiao] = arr[i];
                    jiao++;
                }
            }
        }
        int[] res = new int[jiao];
        for(int i = 0; i<jiao; i++){
            res[i] = crr[i];
        }
        return res;

    }
}